﻿using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic;
using System.Text;

namespace NP.BPMReportPlatform.Reports.CommonReportConfigs.Dtos
{
    public class CommonReportPageInput : PagedAndSortedRequestDto
    {
        public string PageCode { get; set; }

        public string PageName { get; set; }

        public int? PageType { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool? IsEnabled { get; set; }

        public string TableName { get; set; }
    }

    public class UpdateCommonReportPageInput
    {
        public string Id { get; set; }

        public string PageCode { get; set; }

        public string PageName { get; set; }

        public int PageType { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool IsEnabled { get; set; }

        public string DbName { get; set; }

        public string TableName { get; set; }
    }

    public class DeleteCommonReportInput
    {
        public string Id { get; set; }
    }

    public class BindPageModuleInput
    {
        public List<BindPageModuleModel> BindList { get; set; } = new List<BindPageModuleModel>();
    }

    public class BindPageModuleModel
    {
        public string PageId { get; set; }

        public string ModuleId { get; set; }
    }

    public class DeletePageModuleInput
    {
        public List<string> Ids { get; set; } = new List<string>();
    }

    public class CommonReportModuleInput : PagedAndSortedRequestDto
    {
        public string PageId { get; set; }

        /// <summary>
        /// 模块名称
        /// </summary>
        public string ModuleName { get; set; }

        /// <summary>
        /// 模块类型（多选）：1.列表查询 2.编辑 3.只读详情
        /// </summary>
        public string ModuleType { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool? IsEnabled { get; set; }
    }

    public class UpdateCommonReportModuleInput
    {
        public string Id { get; set; }

        public string PageId { get; set; }

        /// <summary>
        /// 模块名称
        /// </summary>
        public string ModuleName { get; set; }

        /// <summary>
        /// 模块宽度
        /// </summary>
        public decimal? ModuleWidth { get; set; }

        /// <summary>
        /// 模块高度
        /// </summary> 
        public decimal? ModuleHeight { get; set; }

        /// <summary>
        /// 模块类型（多选）：1.列表查询 2.编辑 3.只读详情
        /// </summary>
        public string ModuleType { get; set; }

        /// <summary>
        /// 展示方式：1.弹出框 2.页面上直接显示 
        /// </summary>
        public int ShowType { get; set; } = 1;

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool IsEnabled { get; set; }

        public int ReportType { get; set; }

        /// <summary>
        /// 授权代码
        /// </summary>
        public string AuthCode { get; set; }
    }

    public class CommonReportFieldInput : PagedAndSortedRequestDto
    {
        /// <summary>
        /// 模块Id
        /// </summary>
        public string ModuleId { get; set; }

        /// <summary>
        /// 输入类型
        /// </summary>
        public string InputBoxType { get; set; }

        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { get; set; }
    }

    public class UpdateCommonReportFieldInput
    {
        public string Id { get; set; }

        /// <summary>
        /// 模块Id
        /// </summary>
        public string ModuleId { get; set; }

        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { get; set; }

        /// <summary>
        /// 字段描述
        /// </summary>
        public string FieldDesc { get; set; }


        /// <summary>
        /// 下拉框选项（Json）
        /// </summary>
        public string ShortSelectItemJson { get; set; }

        /// <summary>
        /// 输入框样式
        /// </summary>
        public string InputBoxType { get; set; }

        /// <summary>
        /// 表格列宽
        /// </summary>
        public string ColumnWidth { get; set; }

        /// <summary>
        /// 输入框宽度
        /// </summary>
        public string InputBoxWidth { get; set; }

        /// <summary>
        /// 输入框高度
        /// </summary>
        public string InputBoxHeight { get; set; }

        /// <summary>
        /// 是否可编辑
        /// </summary>
        public bool IsCanEdit { get; set; }

        /// <summary>
        /// 是否必填项
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 是否查询项
        /// </summary>
        public bool IsSearchItem { get; set; }

        /// <summary>
        /// 是否在显示
        /// </summary>
        public bool IsShow { get; set; }

        /// <summary>
        /// 是否可导出
        /// </summary>
        public bool IsCanExport { get; set; }

        /// <summary>
        /// 是否可导入
        /// </summary>
        public bool IsCanImport { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int ShowIndex { get; set; } = 0;

        public string CustomScript { get; set; }

        public bool IsAccurate { get; set; }

        public int OrderIndex { get; set; } = 0;

        public string OrderType { get; set; }

        /// <summary>
        /// 校验类型 1 唯一
        /// </summary>
        public int? CheckType { get; set; }

        /// <summary>
        /// 校验
        /// </summary>
        public string RegexContent { get; set; }

        /// <summary>
        /// 校验失败提示信息
        /// </summary>
        public string CheckFailMessage { get; set; }

        /// <summary>
        /// 默认值类型 1.当前时间 2.当前用户Id 3.当前用户工号 4.当前用户名 5.Guid 1000.自定义
        /// </summary>
        public int? DefaultType { get; set; }

        /// <summary>
        /// 自定义默认值
        /// </summary>
        public string DefaultValue { get; set; }
    }

    public class BatchAddCommonReportFieldInput
    {
        public List<UpdateCommonReportFieldInput> BatchAddFields { get; set; } = new List<UpdateCommonReportFieldInput>();
    }

    public class CommonReportInitTableInput
    {
        public string DBName { get; set; }

        public string TableName { get; set; }

        public string PageId { get; set; }

        public string ModuleType { get; set; }
    }

    public class CommonReportCustomScriptsInput : PagedAndSortedRequestDto
    {
        public string ModuleId { get; set; }

        public int? ScriptType { get; set; }
    }

    public class UpdateCommonReportCustomScriptsInput
    {
        public string Id { get; set; }

        public string ModuleId { get; set; }

        public string CustomScript { get; set; }

        /// <summary>
        /// 1.查询数据（SELECT） 2.统计数量（COUNT，SUM） 3.新增数据（INSERT） 4.更新数据（UPDATE） 5.删除数据（DELETE） 6.数据校验（COUNT(*)>0，返回bool）
        /// </summary>
        public int ScriptType { get; set; }

        /// <summary>
        /// 可以配置校验失败报错信息之类的
        /// </summary>
        public string Message { get; set; }
    }
}
